package edu.avans.hartigehap.domain.decorator;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.SecondaryTable;
import javax.persistence.Transient;

@Entity
@DiscriminatorValue("MenuItemDecorator")
//@SecondaryTable(name = "MENUITEMS", pkJoinColumns = @PrimaryKeyJoinColumn(name = "MENUITEM_ID"))
public abstract class MenuItemDecorator extends AbstractMenuItem {
	private static final long serialVersionUID = 1L;
	protected AbstractMenuItem abstractMenuItem;
	
	protected TestIngredient testIngredient;
	
	public MenuItemDecorator(AbstractMenuItem ami){
		abstractMenuItem = ami;
	}
	
	public MenuItemDecorator(){}

	@Override
	@Transient
	public int getPrice(){
		return abstractMenuItem.getPrice();
	}
	
	@Override
	public void setPrice(int price){
		abstractMenuItem.setPrice(price);
	}
	
	@Transient
	public TestIngredient getTestIngredient() {
		return testIngredient;
	}

	public void setTestIngredient(TestIngredient testIngredient) {
		this.testIngredient = testIngredient;
	}	
	

	@ManyToOne(fetch = FetchType.EAGER)
	public AbstractMenuItem getAbstractMenuItem(){
		return abstractMenuItem;
	}
	
	public void setAbstractMenuItem(AbstractMenuItem ami){
		abstractMenuItem = ami;
	}
}
